<template>
	<view class="pos-order-list" ref="container">
	 
		<view class="list" style="margin-top: 0rpx;">
			<view class="item" v-for="(item, listIndex) in list" :key="listIndex">
				<view class="order-num acea-row row-middle" @click="toDetail(item)">
					<text>订单号：{{ item.orderId }}</text>
				<!-- 	<text class="time acea-row row-between">
						<text>下单时间：</text>
						<text class="conter">{{ item.createTime }}</text>
					</text> -->
					<text class="time acea-row row-between"  >
						<text>成交时间：</text>
						<text class="conter">{{ item.confirmReceiptTime }}</text>
					</text>
				</view>
				<view class="pos-order-goods" v-for="(val, key) in item.cartInfo" :key="key">
					<view class="goods acea-row row-between-wrapper" @click="toDetail(item)">
						<view class="picTxt acea-row row-between-wrapper">
							<view class="pictrue">
								<image :src="val.productInfo.image" />
							</view>
							<view class="text acea-row row-between row-column">
								<view class="info line2">{{ val.productInfo.storeName }}</view>
								<view class="attr" v-if="val.productInfo.sku">{{ val.productInfo.sku }}</view>
							</view>
						</view>
						<view class="money">
							<view class="x-money">{{ val.productInfo.price }}豆</view>
							<view class="num">x{{ val.cartNum }}</view>
						<!-- 	<view class="y-money">￥{{ val.productInfo.otPrice }}</view> -->
						</view>
					</view>
				</view>
				<!-- <view class="public-total">
					共{{ item.totalNum }}件商品，应支付
					<text class="money">￥{{ item.payPrice }}</text>
					( 邮费 ¥{{item.totalPostage}})
				</view> -->
				
				<view class="public-total">
					共{{ item.totalNum }}件商品，
					<text class="money" v-if="item.confirmReceiptTime">本单收入￥{{ item.totalPrice- item.couponPrice-item.platformCommission}}</text>
					<text class="money" v-else>本单金额￥{{ item.totalPrice}}</text>
					<text v-if="item.confirmReceiptTime"> ( 平台费 ¥{{item.platformCommission}})</text>
					
				</view>
				 
			</view>
		</view>
		<Loading :loaded="loaded" :loading="loading"></Loading>
		 
	</view>
</template>
<script>
 
	import Loading from "@/components/Loading";
	import DataFormat from "@/components/DataFormat";
	import {transOrderList} from "@/api/admin";  
	import { validatorDefaultCatch	} from "@/utils/dialog";
		
	export default {
		name: "TransOrderList",
		components: { 
			Loading,
			DataFormat
		},
		props: {},
		data() {
			return {
				current: "",
				change: false,
				where: {
					page: 1,
					limit: 20,
					 
				},
				list: [],
				loaded: false,
				loading: false,
				orderInfo: {},
				status: ""
			};
		},
		// watch: {
		// 	"$yroute.query.types": function(newVal) {
		// 		let that = this;
		// 		if (newVal != undefined) {
				 
		// 			that.where.status = newVal;
		// 			that.init();
		// 		}
		// 	},
		// 	types: function() {
		// 		this.getIndex();
		// 	}
		// },
		mounted() {
			let that = this;
			// that.where.status = that.$yroute.query.types;
			// that.current = "";
			that.getIndex();
		},
		onReachBottom() {
			!this.loading && this.getIndex();
		},
		methods: { 
			more: function(index) {
				if (this.current === index) this.current = "";
				else this.current = index;
			},
		  
			init: function() {
				this.list = [];
				this.where.page = 1;
				this.loaded = false;
				this.loading = false;
				this.getIndex();
				this.current = "";
			},
			getIndex: function() {
				let that = this;
				if (that.loading || that.loaded) return;
				that.loading = true;
				transOrderList(that.where).then(
					res => {
						that.loading = false;
						that.loaded = res.data.length < that.where.limit;
						that.list.push.apply(that.list, res.data);
						that.where.page = that.where.page + 1;
					},
					err => {
						that.loading = false;
						uni.showToast({
							title: res.msg,
							icon: "none",
							duration: 2000
						});
					}
				);
			},
			 
			toDetail: function(item) {
				this.$yrouter.push({
					path: "/pagesMer/orderAdmin/TransOrder/detail",
					query: {
						oid: item.orderId
					}
				});
			}
			 
		}
	};
</script>

<style lang="less">
</style>
